<?php
/*
	我的下线
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
$fuwu=$this->get('fuwu',array('mid'=>$_SESSION['uid']));
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('page');
	$return['member']=cfc('core')->member_show($_SESSION['uid']);
	$params=array('uniacid'=>$_SESSION['uniacid'],'fuwu_id'=>$fuwu['id']);
	$return['member']['merchnum']=pdo_count('jy_xiangqin_member',$params,'id');
	$return['params']=array('page'=>1);
	$return['psize']=20;
	$return['list']=array();
	set_html('title',$return['setting']['tmydown']?:'我的客户');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'fuwu_id'=>$fuwu['id']);
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
	);
	$list=pdo_getlist('jy_xiangqin_member',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['member']=cfc('core')->member_show($item['mid']);
		$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
		$item['moneycount']=pdo_getsum('jy_xiangqin_pingorderlog',array('mid'=>$item['mid']),'money');
		$item['ordercount']=pdo_count('jy_xiangqin_pingorderlog',array('mid'=>$item['mid']),'id');
	}
	exi($list);
}
?>